﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ViewModels="clr-namespace:ScrumSprintMonitor.Modules.WorkItemMonitor.ViewModels"
    xmlns:Wpf="clr-namespace:ScrumSprintMonitor.UI.Wpf;assembly=ScrumSprintMonitor.UI.Wpf"
    xmlns:Controls="clr-namespace:ScrumSprintMonitor.Modules.WorkItemMonitor.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ViewboxTeamMemberBadgeDataTemplate.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate x:Key="OnlineDataTemplate">
        <Grid>
            <Controls:SprintWarningBorder/>

            <ScrollViewer VerticalScrollBarVisibility="Disabled" VerticalAlignment="Stretch">
                <ItemsControl ItemsSource="{Binding TeamMembersIncludingUnassigned}" Focusable="False">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <Wpf:AnimatedUniformGrid Columns="{Binding NumberOfColumnsInGridView}" Duration="0:0:2" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
            </ScrollViewer>
        </Grid>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type ViewModels:TeamMembersListViewModel}">
        <ContentPresenter Content="{Binding}" Focusable="False">
            <ContentPresenter.Style>
                <Style TargetType="{x:Type ContentPresenter}">
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate />
                        </Setter.Value>
                    </Setter>

                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=HasException}" Value="False">
                            <Setter Property="ContentTemplate" Value="{StaticResource OnlineDataTemplate}" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ContentPresenter.Style>
        </ContentPresenter>
    </DataTemplate>
</ResourceDictionary>